import { Component, OnInit } from '@angular/core';
import { Response } from '@angular/http';
import {AdService} from '../../../../service/ad.service';

@Component({
  selector: 'app-user-notice',
  templateUrl: './user-notice.component.html',
  styleUrls: ['./user-notice.component.less'],
  providers: [AdService]
})
export class UserNoticeComponent implements OnInit {
  adData;
  currentIndex = 0;
  constructor(private adService: AdService) { }

  ngOnInit() {
    this.adService.getAd().subscribe(
      (response: Response) => {
        const data = response.json();
        this.adData = data;
      }
    );
  }
  currentShow(index: number) {
    this.currentIndex = index;
  }
  hiddenLine() {
    this.currentIndex = 0;
  }

}
